#是否开启调试宏
add_definitions(-DSOFTBUS_DEBUG)

#开启系统宏
add_definitions(-D__LINUX__ -D_GNU_SOURCE -D_SCANTY_MEMORY_)


set(CMAKE_C_FLAGS "-Wall -fPIC -Wno-deprecated")    #设置编译选项


#设置工程根目录
set(ROOT_DIR ${PROJECT_SOURCE_DIR})



#添加包含的头文件路径
include_directories(
        "discovery/coap/include/" 
        "os_adapter/include/" 
        "interfaces/kits/discovery/"      
        "discovery/discovery_service/include/"
        "authmanager/include/"        
        "trans_service/include/libdistbus/"
        "trans_service/include/utils/"
        "trans_service/source/libdistbus/"
        "trans_service/source/utils/"
        "interfaces/kits/transport/"
        "innerkits/deviceauth_lite/"		
		
        #外部依赖		
        "${ROOT_DIR}/third_party/cJSON/" 
        "${ROOT_DIR}/third_party/bounds_checking_function/include/"   
)


#设置源代码文件列表
set(SOURCE_LIST 

    "authmanager/source/auth_conn.c" 
    #"authmanager/source/auth_interface.c" 
    "authmanager/source/bus_manager.c" 
    "authmanager/source/msg_get_deviceid.c" 
    "authmanager/source/wifi_auth_manager.c" 
    
    "discovery/coap/source/coap_adapter.c" 
    "discovery/coap/source/coap_discover.c" 
    "discovery/coap/source/coap_socket.c" 
    "discovery/coap/source/json_payload.c" 
    "discovery/coap/source/nstackx_common.c" 
    "discovery/coap/source/nstackx_device.c" 
    "discovery/discovery_service/source/coap_service.c" 
    "discovery/discovery_service/source/common_info_manager.c" 
    
    "discovery/discovery_service/source/discovery_service.c" 
	
    "os_adapter/source/L1/os_adapter.c" 
	
    "trans_service/source/libdistbus/auth_conn_manager.c" 
    "trans_service/source/libdistbus/tcp_session.c" 
    "trans_service/source/libdistbus/tcp_session_manager.c" 
    "trans_service/source/libdistbus/trans_lock.c" 
    #"trans_service/source/utils/aes_gcm.c" 
    "trans_service/source/utils/message.c" 
    "trans_service/source/utils/tcp_socket.c"
)

#生成动态库
add_library(jy-softbus SHARED ${SOURCE_LIST})

target_link_libraries(jy-softbus cjson bounds_checking_function ipc_lite)   


#设置动态库的版本
SET_TARGET_PROPERTIES(jy-softbus  PROPERTIES VERSION 1.0 SOVERSION 1)


set(LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/../out")

